%数据

x=0.15:0.01:0.38;%腿长变化

% y=[0.010901,0.010677,0.010694,0.010896,0.011207,0.011631,0.012152,0.012732,0.013352,0.014053,0.014755,0.015559,0.016423,0.017328,0.018244,0.019279,0.020296,0.021384,0.022545,0.023707,0.024391,0.022893,0.021273,0.019537,0.015513,0.013284,0.010650];
y=[0.050562,0.050917,0.051136,0.051292,0.051413,0.051511,0.051579,0.051621,0.051653,0.051672,0.051678,0.051671,0.051654,0.051625,0.051586,0.051536,0.051468,0.051397,0.051302,0.051194,0.051074,0.050908,0.050721,0.050481];

%腿部转动惯量随腿长变化

%拟合
p=polyfit(x,y,4)
y_fit=polyval(p,x);
plot(x,y,'o');
hold on;
plot(x,y_fit,'_');
hold off;
legend('原始数据','拟合数据');
title('多项拟合式');
xlabel('x');
xlabel('y');




